class Weather {
  final String time;
  final CityInfo cityInfo;
  final String date;
  final WeatherDetail data;
  final String status;
  final String message;

  Weather.fromJson(Map<Object, dynamic> json)
      : time = json['time'].toString(),
        cityInfo = CityInfo.fromJson(json['cityInfo']),
        date = json['date'].toString(),
        data = WeatherDetail.fromJson(json['data']),
        status = json['status'].toString(),
        message = json['message'].toString();

  Map<String, dynamic> toJson() => {
        'time': time,
        'cityInfo': cityInfo,
        'date': date,
        'data': data,
        'status': status,
        'message': message,
      };
}

class WeatherDetail {
  //shidu: 40%, pm25: 40.0, pm10: 26.0, quality: 良, wendu: -5, ganmao: 极少数敏感人群应减少户外活动
  String shidu;
  String pm25;
  String pm10;
  String quality;
  String wendu;
  String ganmao;

  WeatherDetail.fromJson(Map<String, dynamic> json)
      : shidu = json['shidu'].toString(),
        pm25 = json['pm25'].toString(),
        pm10 = json['pm10'].toString(),
        quality = json['quality'].toString(),
        wendu = json['wendu'].toString(),
        ganmao = json['ganmao'].toString();

  Map<String, dynamic> toJson() => {
        'shidu': shidu,
        'pm25': pm25,
        'pm10': pm10,
        'quality': quality,
        'wendu': wendu,
        'ganmao': ganmao,
      };
}

class CityInfo {
  String city;
  String cityId;
  String parent;
  String updateTime;

  CityInfo.fromJson(Map<String, dynamic> json)
      : city = json['city'].toString(),
        cityId = json['cityId'].toString(),
        parent = json['parent'].toString(),
        updateTime = json['updateTime'];

  Map<String, dynamic> toJson() => {
        'city': city,
        'cityId': cityId,
        'parent': parent,
        'updateTime': updateTime,
      };
}
